import requests


class LoginAPI():
    def login(self,mdata={"username": "19515542478", "password": "123456"},url="/login"):
        # 登录
        my = {"username": "19515542478", "password": "123456"}
        a = requests.post("http://192.168.124.121:8080/login", data=mdata)
        print(a.json())
        # 提取token
        rdata=a.json()
        # rdata = a.json()
        # t = rdata["Admin-Token"]
        t=rdata.get("Admin-Token")

        # h=rdata.get("code")
        # print(h)
        token = {"Admin-Token":t}
        return token,rdata.get("code")

if __name__ == '__main__':
    LoginAPI().login()